package BLL.User;

import BIZ.UserBiz;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

@WebServlet(name = "RegisterUser", value = "/RegisterUser")
public class RegisterUser extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public RegisterUser() {
        super();
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        HttpSession session = request.getSession();


        //从用户界面获取的用户信息(m目前时测试值)
        String UserName = new String(request.getParameter("UserName").getBytes(StandardCharsets.UTF_8));
        String Password = new String(request.getParameter("Password").getBytes(StandardCharsets.UTF_8));
        String PhoneNumber = new String(request.getParameter("PhoneNumber").getBytes(StandardCharsets.UTF_8));
        String UserEmail = new String(request.getParameter("UserEmail").getBytes(StandardCharsets.UTF_8));
        String CarId = new String(request.getParameter("CarId").getBytes(StandardCharsets.UTF_8));
        String Type = new String(request.getParameter("Type").getBytes(StandardCharsets.UTF_8));


        UserBiz userBiz = new UserBiz();
        long User = userBiz.reg(UserName, Password, PhoneNumber, UserEmail, CarId, Type);

    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

}
